<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="/jquery/jquery.js"></script>
</head>
<body>
     <!-- 
       jquery的表单序列化(将对应表单的有效元素数据自动转为 key=value&key=value…… 格式)
       $(form).serialize() 描述:将指定表单元素内的能够用于做数据提交的元素的name值和value值,以查询字符串格式进行拼接
       $(form).serialize() 方法不支持文件上传 
    -->
    <form id="data">
        <input type="text" name="username"> 
        <br><br>
        <textarea cols="30" rows="10" name="info"></textarea> 
        <br><br>
        <input type="radio" name="sex" value="男">男
        <input type="radio" name="sex" value="女">女
        <input type="radio" name="sex" value="未知">未知
        <br><br>
        <input type="checkbox" name="skill" value="html">html
        <input type="checkbox" name="skill" value="css">css
        <input type="checkbox" name="skill" value="JS">JS
        <input type="checkbox" name="skill" value="vue">vue
        <br><br>
        <select name="a">
            <option value="1">1</option>
            <option value="2">2</option>
            <option value="3">3</option>
            <option value="4">4</option>
        </select>
        <br><br>
        <input type="button" value="发送请求" onclick="uploadParams()"> 
    </form>
    <script>
        function uploadParams(){
            let str=$("#data").serialize();//查询字符串格式
            $.ajax({
                url:"/jquery/base",
                data:str,
                success:function(data){
                    console.log(data);
                }
            });
        }
    </script>
</body>
</html>